home *** CD-ROM | disk | FTP | other *** search
- Path: newshost.lanl.gov!tanmoy
- From: tanmoy@qcd.lanl.gov (Tanmoy Bhattacharya)
- Newsgroups: comp.lang.c
- Subject: Re: Function pointers; example code
- Date: 18 Feb 1996 18:20:49 GMT
- Organization: Los Alamos National Laboratory
- Message-ID: <TANMOY.96Feb18112049@qcd.lanl.gov>
- References: <DMwzBL.HDt@ichaos.nullnet.fi>
- NNTP-Posting-Host: qcd.lanl.gov
- Mime-Version: 1.0
- Content-Type: text
- In-reply-to: jlaiho@ichaos.nullnet.fi's message of Sat, 17 Feb 1996 09:50:09 GMT
-
- In article <DMwzBL.HDt@ichaos.nullnet.fi> jlaiho@ichaos.nullnet.fi
- (Juha Laiho) writes:
- <snip>
- Here's a short program I wrote as an example of function pointers. I'd
- appreciate _any_ comments about it.
-
- ---SNIP---
- #include <stdio.h>
-
- typedef void f(int); /* f is a type that is a function taking one int
- * argument and returning an int
- */
-
- Pointless and incorrect comment!
-
- typedef f *ptf; /* ptf is a type that is a pointer to a function */
-
- ptf is a pointer to a specific kind of function.
-
- typedef ptf aptf[]; /* aptf is a type that is an array of ptfs */
-
- f a, b, c; /* Define three functions a, b and c; each is 'void f(int)' */
-
- int
- main ()
-
- int main(void) is preferred stylistically over int main().
-
- Quick glance at the rest shows no obvious mistake.
-
- Cheers
- Tanmoy
- --
- tanmoy@qcd.lanl.gov(128.165.23.46) DECNET: BETA::"tanmoy@lanl.gov"(1.218=1242)
- Tanmoy Bhattacharya O:T-8(MS B285)LANL,NM87545 H:#9,3000,Trinity Drive,NM87544
- Others see <gopher://yaleinfo.yale.edu:7700/00/Internet-People/internet-mail>,
- <http://alpha.acast.nova.edu/cgi-bin/inmgq.pl>or<ftp://csd4.csd.uwm.edu/pub/
- internetwork-mail-guide>. -- <http://nqcd.lanl.gov/people/tanmoy/tanmoy.html>
- fax: 1 (505) 665 3003 voice: 1 (505) 665 4733 [ Home: 1 (505) 662 5596 ]
-